package kr.saeildamil.androidstudty.ch19;

import kr.saeildamil.androidstudty.R;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Toast;

public class JobScheduleTest extends Activity {
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.ch19_jobscheduletest);
		
		findViewById(R.id.ch19_jobschedule_upload).setOnClickListener(new OnClickListener() {
			public void onClick(View v) {
				new AlertDialog.Builder(JobScheduleTest.this)
				.setTitle("질문")
				.setMessage("업로드 하시겠습니까?")
				.setPositiveButton("예", new DialogInterface.OnClickListener() {
					public void onClick(DialogInterface dialog, int which) {
						doUpload();
					}
				})
				.setNegativeButton("아니오", null)
				.show();
			}
		});
	}
	
	public void doUpload(){
		for(int i=0; i<20; i++){
			try{Thread.sleep(500);}catch(Exception e){}
		}
		Toast.makeText(this, "업로드 완료", Toast.LENGTH_LONG).show();
	}
}
